﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace automata
{

    

    public partial class View : Form
    {
       

        public View()
        {
            InitializeComponent();
        }
         Random rnd = new Random();
         int id_1, id_2,id_3,id_4, pin;
         Mode mode = new Mode();
         int cash;
       

        
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool b=true;
            mode.login(textBox1.Text,textBox5.Text,ref b);
            if (b == true)
            {
                button3.Visible = true;
                button4.Visible = true;
                button2.Visible = true;
            }
        }

        private void View_Load(object sender, EventArgs e)
        {
            id_1 = rnd.Next(1000, 9999);
            id_2 = rnd.Next(1000, 9999);
            id_3 = rnd.Next(1000, 9999);
            id_4 = rnd.Next(1000, 9999);
            cash = rnd.Next(1, 200000);

            textBox2.Text = Convert.ToString(id_1);
            textBox3.Text = Convert.ToString(id_2);
            textBox4.Text = Convert.ToString(id_3);
            textBox5.Text = Convert.ToString(id_4);

            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            mode.logout(ref id_1,ref id_2,ref id_3,ref id_4,ref pin);

            textBox2.Text = Convert.ToString("");
            textBox3.Text = Convert.ToString("");
            textBox4.Text = Convert.ToString("");
            textBox5.Text = Convert.ToString("");

            textBox1.Text = Convert.ToString("");

            button3.Visible = false;
            button4.Visible = false;
            button2.Visible = false;

            id_1 = rnd.Next(1000, 9999);
            id_2 = rnd.Next(1000, 9999);
            id_3 = rnd.Next(1000, 9999);
            id_4 = rnd.Next(1000, 9999);
            cash = rnd.Next(1, 200000);

            textBox2.Text = Convert.ToString(id_1);
            textBox3.Text = Convert.ToString(id_2);
            textBox4.Text = Convert.ToString(id_3);
            textBox5.Text = Convert.ToString(id_4);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            mode.balance(cash);
        }

        private void button4_Click(object sender, EventArgs e)
        {

        }
    }
}
